import cv2 as cv
import numpy as np

def detect_color(color):
    src_img = cv.imread('image\\color.png', cv.IMREAD_COLOR)
    cv.namedWindow('src_image')
    cv.namedWindow('dst_image')
    if color == 'blue':
        blue_l = np.array([100, 43, 46])
        blue_h = np.array([124, 255, 255])
        hsv_img = cv.cvtColor(src_img, cv.COLOR_BGR2HSV)
        mask = cv.inRange(hsv_img, blue_l, blue_h)
        dst_img = cv.bitwise_and(src_img, src_img, mask=mask)
        cv.imshow('src_image', src_img)
        cv.imshow('dst_image', dst_img)
#        cv.imshow('mask image', mask)
        cv.waitKey(0)
        pass
    elif color == 'green':
        pass
    else:
        b_bgr = np.uint8([[[255, 0, 0]]])
        b_hsv = cv.cvtColor(b_bgr, cv.COLOR_BGR2HSV)
        print(color+' color not supper\r\n')
        print('b_hsv:', b_hsv)
        pass


if __name__ == '__main__':
    detect_color('blue')
